<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台登录-X-admin1.1</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__PUBLIC__/admin/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="__PUBLIC__/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/xadmin.js"></script>

</head>
<body>
    <!-- 中部开始 -->
    <div class="wrapper">
        <!-- 右侧主体开始 -->
        <div class="page-content" style="padding: 0px;">
          <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">用户</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" value="{$userwp_info.name}" class="layui-input" disabled="" style="color: #999;">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="padding-top: 10px;font-size: 8px;color: red;">
                            <span>注：用户/手机不能修改</span>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">手机</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" value="{$userwp_info.phone}" class="layui-input" disabled="" style="color: #999;">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">收书方式</label>
                    <div style="margin: 1px 20px;">
                      <div style="float: left;" id="xcjs">
                        <input type="radio" name="is_fanshi" value="0" title="现场捐书" {$userwp_info['is_fanshi']==0?'checked':''}>
                      </div>
                      <div id="smss">
                        <input type="radio" name="is_fanshi" value="1" title="上门收书" {$userwp_info['is_fanshi']==1?'checked':''}>
                      </div>
                    </div>
                </div>
                <div class="layui-form-item" id="ssdz" {$userwp_info['is_fanshi']==0?"style='display: none;'":''}>
                    <label for="L_city" class="layui-form-label">捐赠地址</label>
                    <div class="layui-input-inline">
                        <input type="text" name="address" autocomplete="off" value="{$userwp_info.address}" class="layui-input" placeholder="无">
                    </div>
                </div>
                <script type="text/javascript">
                    $(function(){
                        $('#smss').click(function(event) {
                            $('#ssdz').show();
                            }
                        );
                        $('#xcjs').click(function(event) {
                            $('#ssdz').hide();
                            }
                        );
                    })
                </script>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">捐赠数量</label>
                    <div class="layui-input-inline">
                        <input type="text" name="num" autocomplete="off" value="{$userwp_info.num}" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">捐赠物品</label>
                    <div class="layui-input-block">
                        <textarea placeholder="输入捐赠物品" name="wp_name" autocomplete="off" class="layui-textarea" style="min-height: 0px;width: 350px;">{$userwp_info.wp_name}</textarea>
                        <div class="layui-input-inline" style="position: absolute;right: 120px;top: 10px;font-size: 8px;color: red;">
                            <span>注：对多个物品用逗号分开 <br>格式：物品1,物品2,物品3,...</span>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label for="L_sign" class="layui-form-label">
                        赠品动态
                    </label>
                    <div class="layui-input-block">
                        <textarea placeholder="输入赠品去向动态" name="sign" autocomplete="off" class="layui-textarea" style="min-height: 0px;width: 350px;">{$userwp_info.qx}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_sign" class="layui-form-label">
                    </label>
                    <input type="hidden" name="id" value="{$userwp_info.id}">
                    <button class="layui-btn" key="set-mine" lay-filter="save" lay-submit>保存</button>
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
          </div>
        </div>
        <!-- 右侧主体结束 -->
    </div>
    <!-- 中部结束 -->
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;

              //监听提交
              form.on('submit(save)', function(data){
                //console.log(data);
                //发异步，把数据提交给php
                $.ajax({
                    url: "{:U('admin/userwp/edit')}",//请求地址
                    type: "post",//请求方式
                    dataType: "json",//返回数据类型
                    data: data.field,//发送的参数
                    })
                    .done(function(response) {
                          if(response.error==0){
                             layer.msg(response.info ,{icon:5});

                          }else{
                            layer.alert(response.info, {icon: 6},function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                                parent.location.reload();
                            });
                          }
                      })
                    .fail(function() {
                        alert("ajxs交互失败");
                    })  

                return false;
              });
              
            });
        </script>
</body>
</html>